package cn.jsu.oj.dispatchServer;

import cn.jsu.oj.dispatchServer.net.DispatchServer;
import cn.jsu.oj.dispatchServer.thread.DispatchThread;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;


/**
 * @author ahtonc
 */
@SpringBootApplication
@EnableScheduling
public class Application {

    public static void main(String[] args) throws InterruptedException {

        try {

            run();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
        SpringApplication.run(Application.class, args);
    }

    public static void run() throws Exception {

        new Thread(() -> new DispatchThread().run(), "DispatchThread1").start();

        //new Thread(() -> new DispatchThread().run(),"DispatchThread2").start();

        new Thread(() -> new DispatchServer().startServer(), "DispatchServer").start();
    }
}